package 基础篇.线程同步.死锁;

/**
 * @author IBM CHEN ZHI KAN
 * @create 2018/7/28
 */
public class DeadLock implements Runnable{

    A a=new A();
    B b=new B();
  public static void main(String[] args) {
    DeadLock d1=new DeadLock();
    new Thread(d1).start();
    d1.init();
  }

  public void init(){
    Thread.currentThread().setName("主线程");
    a.foo(b);
    System.out.println("进入主线程之后");
  }
  @Override
  public void run() {
    Thread.currentThread().setName("副线程");
    b.foo(a);
    System.out.println("进入副线程之后");
  }
}
